Optimal. Leaf size=115 \[ \frac {\left (2 a b B-a^2 C+b^2 C\right ) x}{\left (a^2+b^2\right )^2}-\frac {\left (a^2 B-b^2 B+2 a b C\right ) \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right )^2 d}+\frac {a (b B-a C)}{b \left (a^2+b^2\right ) d (a+b \tan (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 115, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 3, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.094, Rules used = {3709, 3612,
3611} \begin {gather*} \frac {a (b B-a C)}{b d \left (a^2+b^2\right ) (a+b \tan (c+d x))}-\frac {\left (a^2 B+2 a b C-b^2 B\right ) \log (a \cos (c+d x)+b \sin (c+d x))}{d \left (a^2+b^2\right )^2}+\frac {x \left (a^2 (-C)+2 a b B+b^2 C\right )}{\left (a^2+b^2\right )^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3611
Rule 3612
Rule 3709
Rubi steps
\begin {align*} \int \frac {B \tan (c+d x)+C \tan ^2(c+d x)}{(a+b \tan (c+d x))^2} \, dx &=\frac {a (b B-a C)}{b \left (a^2+b^2\right ) d (a+b \tan (c+d x))}+\frac {\int \frac {b B-a C+(a B+b C) \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{a^2+b^2}\\ &=\frac {\left (2 a b B-a^2 C+b^2 C\right ) x}{\left (a^2+b^2\right )^2}+\frac {a (b B-a C)}{b \left (a^2+b^2\right ) d (a+b \tan (c+d x))}-\frac {\left (a^2 B-b^2 B+2 a b C\right ) \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{\left (a^2+b^2\right )^2}\\ &=\frac {\left (2 a b B-a^2 C+b^2 C\right ) x}{\left (a^2+b^2\right )^2}-\frac {\left (a^2 B-b^2 B+2 a b C\right ) \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right )^2 d}+\frac {a (b B-a C)}{b \left (a^2+b^2\right ) d (a+b \tan (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 1.51, size = 140, normalized size = 1.22 \begin {gather*} \frac {\frac {(B+i C) \log (i-\tan (c+d x))}{(a+i b)^2}+\frac {(B-i C) \log (i+\tan (c+d x))}{(a-i b)^2}+\frac {2 \left (\left (-a^2 B+b^2 B-2 a b C\right ) \log (a+b \tan (c+d x))-\frac {a \left (a^2+b^2\right ) (-b B+a C)}{b (a+b \tan (c+d x))}\right )}{\left (a^2+b^2\right )^2}}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.16, size = 145, normalized size = 1.26
method | result | size |
derivativedivides | \(\frac {\frac {a \left (B b -C a \right )}{\left (a^{2}+b^{2}\right ) b \left (a +b \tan \left (d x +c \right )\right )}-\frac {\left (a^{2} B -b^{2} B +2 C a b \right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}+\frac {\frac {\left (a^{2} B -b^{2} B +2 C a b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (2 B a b -C \,a^{2}+b^{2} C \right ) \arctan \left (\tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{d}\) | \(145\) |
default | \(\frac {\frac {a \left (B b -C a \right )}{\left (a^{2}+b^{2}\right ) b \left (a +b \tan \left (d x +c \right )\right )}-\frac {\left (a^{2} B -b^{2} B +2 C a b \right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}+\frac {\frac {\left (a^{2} B -b^{2} B +2 C a b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (2 B a b -C \,a^{2}+b^{2} C \right ) \arctan \left (\tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{d}\) | \(145\) |
norman | \(\frac {\frac {a \left (2 B a b -C \,a^{2}+b^{2} C \right ) x}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {b \left (2 B a b -C \,a^{2}+b^{2} C \right ) x \tan \left (d x +c \right )}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {a \left (B b -C a \right )}{\left (a^{2}+b^{2}\right ) b d}}{a +b \tan \left (d x +c \right )}+\frac {\left (a^{2} B -b^{2} B +2 C a b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}-\frac {\left (a^{2} B -b^{2} B +2 C a b \right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}\) | \(221\) |
risch | \(\frac {i x B}{2 i b a -a^{2}+b^{2}}+\frac {x C}{2 i b a -a^{2}+b^{2}}+\frac {2 i a^{2} B x}{a^{4}+2 a^{2} b^{2}+b^{4}}-\frac {2 i B \,b^{2} x}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {4 i C a b x}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {2 i a^{2} B c}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) d}-\frac {2 i B \,b^{2} c}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {4 i C a b c}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}-\frac {2 i a B b}{\left (i b +a \right ) d \left (-i b +a \right )^{2} \left (-i b \,{\mathrm e}^{2 i \left (d x +c \right )}+a \,{\mathrm e}^{2 i \left (d x +c \right )}+i b +a \right )}+\frac {2 i a^{2} C}{\left (i b +a \right ) d \left (-i b +a \right )^{2} \left (-i b \,{\mathrm e}^{2 i \left (d x +c \right )}+a \,{\mathrm e}^{2 i \left (d x +c \right )}+i b +a \right )}-\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) b^{2} B}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}-\frac {2 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) C a b}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}\) | \(477\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.52, size = 185, normalized size = 1.61 \begin {gather*} -\frac {\frac {2 \, {\left (C a^{2} - 2 \, B a b - C b^{2}\right )} {\left (d x + c\right )}}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {2 \, {\left (B a^{2} + 2 \, C a b - B b^{2}\right )} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac {{\left (B a^{2} + 2 \, C a b - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {2 \, {\left (C a^{2} - B a b\right )}}{a^{3} b + a b^{3} + {\left (a^{2} b^{2} + b^{4}\right )} \tan \left (d x + c\right )}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.61, size = 221, normalized size = 1.92 \begin {gather*} -\frac {2 \, C a^{2} b - 2 \, B a b^{2} + 2 \, {\left (C a^{3} - 2 \, B a^{2} b - C a b^{2}\right )} d x + {\left (B a^{3} + 2 \, C a^{2} b - B a b^{2} + {\left (B a^{2} b + 2 \, C a b^{2} - B b^{3}\right )} \tan \left (d x + c\right )\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - 2 \, {\left (C a^{3} - B a^{2} b - {\left (C a^{2} b - 2 \, B a b^{2} - C b^{3}\right )} d x\right )} \tan \left (d x + c\right )}{2 \, {\left ({\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} d \tan \left (d x + c\right ) + {\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [C] Result contains complex when optimal does not.
time = 0.86, size = 2995, normalized size = 26.04 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 241 vs.
\(2 (117) = 234\).
time = 0.70, size = 241, normalized size = 2.10 \begin {gather*} -\frac {\frac {2 \, {\left (C a^{2} - 2 \, B a b - C b^{2}\right )} {\left (d x + c\right )}}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac {{\left (B a^{2} + 2 \, C a b - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {2 \, {\left (B a^{2} b + 2 \, C a b^{2} - B b^{3}\right )} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{4} b + 2 \, a^{2} b^{3} + b^{5}} - \frac {2 \, {\left (B a^{2} b^{2} \tan \left (d x + c\right ) + 2 \, C a b^{3} \tan \left (d x + c\right ) - B b^{4} \tan \left (d x + c\right ) - C a^{4} + 2 \, B a^{3} b + C a^{2} b^{2}\right )}}{{\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} {\left (b \tan \left (d x + c\right ) + a\right )}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 9.01, size = 163, normalized size = 1.42 \begin {gather*} \frac {a\,\left (B\,b-C\,a\right )}{b\,d\,\left (a^2+b^2\right )\,\left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (B+C\,1{}\mathrm {i}\right )}{2\,d\,\left (a^2+a\,b\,2{}\mathrm {i}-b^2\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (C+B\,1{}\mathrm {i}\right )}{2\,d\,\left (a^2\,1{}\mathrm {i}+2\,a\,b-b^2\,1{}\mathrm {i}\right )}-\frac {\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )\,\left (\frac {B}{a^2+b^2}-\frac {2\,b\,\left (B\,b-C\,a\right )}{{\left (a^2+b^2\right )}^2}\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________